package com.example.demo.entity.request.uiTestCaseReq;

import com.example.demo.entity.request.ParamValidate;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

@Data
public class UITestCaseAddReq implements ParamValidate {

    @ApiModelProperty(value = "测试用例分类id")
    private Long uiTestCaseSuiteId;
    @ApiModelProperty(value = "环境变量id")
    private int envId;
    @ApiModelProperty(value = "测试用例名称")
    private String name;
    @ApiModelProperty(value = "项目id")
    private Long projectId;
    @ApiModelProperty(value = "用例是否跳过")
    private Boolean isSkip;
    @ApiModelProperty(value = "备注")
    private String remark;

    @Override
    public void validate() {
        if (uiTestCaseSuiteId ==null || uiTestCaseSuiteId <=0){
            throw new IllegalArgumentException("测试用例分类id不能为空");
        }
        if (StringUtils.isEmpty(name)){
            throw new IllegalArgumentException("名称不能为空");
        }
        if (projectId == null || projectId <= 0){
            throw new IllegalArgumentException("项目id不能为空");
        }
    }
}
